按照官網上說的,第1步,就是先安裝laravel的安裝器
composer global require laravel/installer
但是卻出現了這個錯誤
Changed current directory to /home/xx/.composer
Cannot create cache directory /home/xx/.composer/cache/repo/https---packagist.org/, or directory is not writable. Proceeding without cache
Cannot create cache directory /home/xx/.composer/cache/files/, or directory is not writable. Proceeding without cache
這是怎麼回事呢?這是因為/home/xx/.composer這個目錄是root的,所以你用xx的身份去執行,就會出現這個錯誤
所以你只要先把.composer的擁有者改成xx就可以了
sudo chown -R xx:xx .composer/
這時安裝就正常了
xx@xx:/test2$ composer global require laravel/installer
Changed current directory to /home/xx/.composer
Using version ^2.0 for laravel/installer
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Generating autoload files
想對外分享這則貼文嗎?運用網址更方便呦~